import Vue from 'vue'
import Router from 'vue-router'
import bpmnModule from '../views/bpmnModule/index.vue'
import Process from '../views/Process/index.vue'
import goProcess from '../components/process/components/index.vue'
import todo from '../views/todo/index.vue'
import task from '../views/task/index.vue'
import ProcessForm from '../views/ProcessForm/index.vue'
import login from '../views/login/index.vue'
import kFormDesign from '../views/kFormDesign/index.vue'
import formConfiguration from '../views/formConfiguration/index.vue'
import editProcess from '../views/Process/model.vue'

Vue.use(Router)

// 公共路由
export const constantRoutes = [
  {
    path: '/',
    component: Process,
  },
  {
    path: '/Process',
    component: bpmnModule,
  },
  {
    path: '/editProcess',
    component: editProcess,
  },
  {
    path: '/goProcess',
    component: goProcess,
  },
  {
    path: '/todo',
    component: todo,
  },
  {
    path: '/task',
    component: task,
  },
  {
    path: '/ProcessForm',
    component: ProcessForm,
  },
  {
    path: '/login',
    component: login,
  },
  {
    path: '/kFormDesign',
    component: kFormDesign,
  },
  {
    path: '/formConfiguration',
    component: formConfiguration,
  },
]

const originalPush = Router.prototype.push

Router.prototype.push = function push(location) {
  return originalPush.call(this, location).catch(err => err)
}
export default new Router({
  scrollBehavior: () => ({ y: 0 }),
  routes: constantRoutes
})
